package WuHanTrainStation;

import java.util.regex.Pattern;

//正则匹配类
public class Regular {
    public boolean matchingTrains(String getTrains) {
        String pattern = "^([TKDGCLZAY]|[1-7]){1}\\d{1,4}$";
        return Pattern.matches(pattern, getTrains);
    }

    public boolean matchingArrivingTime(String getArrivingTime) {
        String pattern = "^([012][0-9])\\:([0-5][0-9])$";
        return Pattern.matches(pattern, getArrivingTime);
    }

    public boolean matchingDepartureTime(String getDepartureTime) {
        String pattern = "^([012][0-9])\\:([0-5][0-9])$";
        return Pattern.matches(pattern, getDepartureTime);
    }

    public boolean matchingType(String getType) {
        String pattern = "[TKDGCLZAY]";
        return Pattern.matches(pattern, getType);
    }

    public boolean matchingField(String getField) {
        String pattern = "^[\u4e00-\u9fa5]{0,}$";
        return Pattern.matches(pattern, getField);
    }

    public boolean matchingStation(String getStation) {
        String pattern = "^[\u4e00-\u9fa5]{0,}$";
        return Pattern.matches(pattern, getStation);
    }
}